<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>对象</title>
    <script>
        let weight = "50g";
        let obj = {
            name: "dean",
            color: "red",
            fn1: function () {
                console.log("方法1")
            },
            fn2() {
                console.log("方法2")
            },
            weight
        }
        console.log(obj);
        let attr="color";
        console.log(obj.name);
        console.log(obj[attr]);
        obj.fn1();
        obj.fn2();
        obj.height="185cm";
        obj.name="harris"
    </script>
</head>

<body>

</body>

</html>